//
// Created by wkm on 2023-12-03.
//

#ifndef MYSYSTEMCLEARNING_ASYNC_STATES_H
#define MYSYSTEMCLEARNING_ASYNC_STATES_H

#include "systemc.h"

const int STATE_BITS = 4;

SC_MODULE(async_states) {
    sc_in<bool> clk, reset, set;
    sc_in<sc_uint<STATE_BITS> > current_state;
    sc_out<sc_uint<STATE_BITS> > next_state;

    void prc_async_state();

    SC_CTOR(async_states) {
        SC_METHOD(prc_async_state);
        // 时钟的负跳变沿，低电平复位有效
        sensitive_neg << clk << reset;
        sensitive_pos << set;
    }
};

#endif //MYSYSTEMCLEARNING_ASYNC_STATES_H
